//
//  PingJIACELL.m
//  QinghaiTourism
//
//  Created by QianXiaoShu on 16/3/10.
//  Copyright © 2016年 QianXiaoShu. All rights reserved.
//

#import "PingJIACELL.h"

CGFloat rotHeight = 50;

@implementation PingJIACELL

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self= [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self initInterface];//初始化加载到cell上的控件
           }
    return self;
}
-(void)initInterface{
    //配置_logoImageVIew
    _logoImageVIew = [[UIImageView alloc] init];
    _logoImageVIew.frame = CGRectMake(10, 10, 40, 40);
    _logoImageVIew.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:_logoImageVIew];
    
    _name = [[UILabel alloc]init];
    _name.frame = CGRectMake(50, 10, 300, 20);
    _name.textColor = [UIColor darkGrayColor];
    _name.font = [UIFont  systemFontOfSize:14];
    [self.contentView addSubview:_name];
    
 
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.font = [UIFont  systemFontOfSize:13];
    _titleLabel.frame = CGRectMake(50, 50, kWindowWidth-40-10, 20);
    _titleLabel.numberOfLines = 0;
    [self.contentView addSubview:_titleLabel];
    
    
    
    
    _timeLable = [[UILabel alloc]init];

    _timeLable.frame = CGRectMake(kWindowWidth/2, 0, kWindowWidth/2, 20);
    _timeLable.textAlignment = NSTextAlignmentRight;
    _timeLable.font = [UIFont  systemFontOfSize:13];
    [self.contentView addSubview:_timeLable];
    

    
    

    _logoImageVIew.layer.cornerRadius = 20;
    _logoImageVIew.clipsToBounds = YES;


    
    
}
-(void)layoutSubviews{
    [super layoutSubviews];

    
    _titleLabel.text = [NSString stringWithFormat:@"%@",self.healthModel.title];

    [_titleLabel sizeToFit];

    
  
    _name.text = self.healthModel.listDescription;
   
    _timeLable.text = self.healthModel.ctime;
    
//    NSString *urlstring = [NSString stringWithFormat:@"%@",@"http://img.saibaizi.com/product/1465783256250.jpg"];
//    [_logoImageVIew setImageWithURL:[NSURL URLWithString:urlstring]] ;
    
    [_logoImageVIew setImageWithURL:[NSURL URLWithString:self.healthModel.picUrl]] ;

    
//   rotHeight = CGRectGetHeight(_titleLabel.frame) +50;




}

+(CGFloat)rowHeight{
    
    return rotHeight;
}

@end
